package org.mango.dict.api;

import com.alibaba.fastjson.JSONArray;
import org.mango.dict.service.DictService;
import org.mango.springboot.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by meigang on 2018/1/31.
 */
@RestController
@RequestMapping(value = "/dict",produces = "application/json; charset=utf-8")
public class DictController extends BaseController {
    @Autowired
    private DictService dictService;

    @RequestMapping("/thedo")
    public String thedo(@RequestParam String words){

        JSONArray rsArr = null;
        try {
            rsArr = dictService.handleWords(words);
            return this.ajaxJson(200,rsArr.toJSONString());
        } catch (org.rex.db.exception.DBException e) {
            e.printStackTrace();
            return this.ajaxJson(300,e.getMessage());
        }

    }
}
